package com.fjh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fjh.domain.Sku;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface SkuMapper extends BaseMapper<Sku> {

    @Update("update sku set stocks = stocks+ #{count},version = version +1 where sku_id = #{skuId} and stocks + #{count} > 0")
    Integer changeSkuStock(@Param("skuId") Long skuId,@Param("count") Integer count);
}